package com.competition.web.admin.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import com.competition.web.admin.config.HttpRequest;
import com.sync.tanm.SyncTanma;

/**
 * 启动后执行
 */
@Component
public class ApplicationListenerImpl implements ApplicationListener<ApplicationStartedEvent> {

//	private static Logger LOGGER = LoggerFactory.getLogger(ApplicationListenerImpl.class);

	
	SyncTanma syncTanma;

	public ApplicationListenerImpl(RedisTemplate<String, ?> redisTemplate, HttpRequest httpRequest) {
		
		 SyncTanma.init(httpRequest, redisTemplate);
		 
		 syncTanma = SyncTanma.getInstance();
	}
	
//	/**
//	 * 放弃人姓名：field 136107
//	 */
//	private static String NAME_OF_ABANDONED_PERSON = "136107";

	@Override
	public void onApplicationEvent(ApplicationStartedEvent event) {

//		this.httpRequest.getThreadPoolTaskExecutor().execute(() -> {

//		});
		
		syncTanma.loadTanma();
	}


	
}
